/// 教程页面模型
///
/// 表示单个教程页面的数据
class TutorialPage {
  /// 页面标题
  final String title;

  /// 页面描述
  final String description;

  /// 图片资源路径（可选，用于展示教程插图）
  final String? imagePath;

  /// 页面索引（从0开始）
  final int pageIndex;

  const TutorialPage({
    required this.title,
    required this.description,
    this.imagePath,
    required this.pageIndex,
  });

  /// 创建副本
  TutorialPage copyWith({
    String? title,
    String? description,
    String? imagePath,
    int? pageIndex,
  }) {
    return TutorialPage(
      title: title ?? this.title,
      description: description ?? this.description,
      imagePath: imagePath ?? this.imagePath,
      pageIndex: pageIndex ?? this.pageIndex,
    );
  }

  @override
  String toString() {
    return 'TutorialPage(index: $pageIndex, title: $title, '
        'hasImage: ${imagePath != null})';
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;

    return other is TutorialPage &&
        other.title == title &&
        other.description == description &&
        other.imagePath == imagePath &&
        other.pageIndex == pageIndex;
  }

  @override
  int get hashCode {
    return Object.hash(
      title,
      description,
      imagePath,
      pageIndex,
    );
  }
}
